<?php
TImport('module');

function ListPhotosById($id)
{
    global $dbsql,$language;
    $id         = intval($id);
    $sql_select = "select cImage,cName from tblgallery where cType='' and iParentId=$id";
    return $dbsql->load($sql_select);
    return $return;
}


function ListCategories_Gallery($idP)
{
     global $dbsql,$language;
    
    
    $idP        = intval($idP);
    $sql_where  = " from tblcategory where cLanguage='$language' and iStatus=1 and iParentId= $idP";
    
    $sql_select = "select count(iId) as count ".$sql_where;
    $result     = $dbsql->query_fetch($sql_select);
    $countall   = $result['count'];
    
    list($lat,$lall)    = Split_Page($countall);
    
    $sql_select = "select iId,iParentId,cName,cUrlString,cImage,cDescription ".$sql_where;
    $sql_select.= " order by iOrder asc limit $lat,$lall";
    $rs         = $dbsql->query($sql_select);
    $rows       = $dbsql->num_rows($rs);
    $return     = '<div class="ajaxpage">';
    $i          = 0;
    
    while($result   = $dbsql->fetch_array($rs))
    {
        $url    = GetLinkCatById($result['iParentId'],$result['cUrlString']);    
        $i ++;
             
        $return .='<div class="galleries">';
        $return .='<a class="thumb" href="'.$url.'"><img src="'.GetIntroImg($result['cImage'],true).'" width=130></a>';
        $return .='<a class="title" href="'.$url.'">'.$result['cName'].'</a>';             
        $return .='</div>';        
    }
    if($rows==0)
    {
        return null;
    }
    $return     .= "<div class='clear'>&nbsp;</div></div>";
    return $return;
}